package com.hung.tripleregistry.service;

import com.hung.tripleregistry.core.model.RpcAdminRegistryRequest;
import com.hung.tripleregistry.core.model.RpcAdminRegistryResponse;
import com.hung.tripleregistry.core.model.RpcRegistry;
import com.hung.tripleregistry.core.result.ReturnT;
import org.springframework.web.context.request.async.DeferredResult;

import java.util.Map;

/**
 * @author Hung
 * @date 2022/10/3 21:34
 */
public interface RpcRegistryService {

    // admin
    Map<String, Object> pageList(int start, int length, String env, String key);

    ReturnT<String> delete(int id);

    ReturnT<String> update(RpcRegistry rpcRegistry);

    ReturnT<String> add(RpcRegistry rpcRegistry);


    // ------------------------ remote registry ------------------------

    /**
     * refresh registry-value, check update and broacase
     */
    RpcAdminRegistryResponse registry(RpcAdminRegistryRequest registryRequest);

    /**
     * remove registry-value, check update and broacase
     */
    RpcAdminRegistryResponse remove(RpcAdminRegistryRequest registryRequest);

    /**
     * discovery registry-data, read file
     */
    RpcAdminRegistryResponse discovery(RpcAdminRegistryRequest registryRequest);

    /**
     * monitor update
     */
    DeferredResult<RpcAdminRegistryResponse> monitor(RpcAdminRegistryRequest registryRequest);

}


